<!DOCTYPE html>
<!--
Copyright 2012 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
  <head>
    <title></title>
    <script src="lib/loader.js"></script>
    <script src="lib/Component.js"></script>
    <style>
      div, g-A, g-B {
        display: block;
        border: 1px dotted red;
        margin: 8px;
        padding: 8px;
      }
    </style>
    <script>
      change = function() {
        Component.register("g-A", ["Base", "A"]);
        Component.register("g-B", ["Base", "B"]);
        Component.upgradeAll();
      }
    </script>
  </head>
  <body onload="change()">
      <g-A><span id="a1">Where am I?</span><span id="a2">Where do I go?</span></g-A>

      <template id="A">[A->]<g-B><content></content></g-B><g-B><shadow></shadow></g-B>[<-A]</template>
      <template id="B">[B->][<content select="#a2"></content>]<shadow></shadow>[<-B]</template>
      <template id="Base">[Base->]<content></content>[<-Base]</template>

      <hr/>

      Expected output (also, see console):

      <div>[A->]
        <div>[B->]<span>[Where do I go?]</span>[Base->]Where Am I?[<-Base][<-B]</div>
        <div>[B->][][Base->][Base->][<-Base][<-Base][<-B]</div>
      [<-A]</div>

</body>
</html>
